import Vue from 'vue'
import Vuex from 'vuex'
import user from './user'
import cart from './cart'

import createPersistedState from 'vuex-persistedstate'

Vue.use(Vuex)

const store = new Vuex.Store({
  plugins: [
    createPersistedState({
      paths: ['cart']
    })
  ],
  modules: {
    user, cart
  },
  state () {
    return {
    }
  },
  actions: {},
  mutations: {

  },
  getters: {
    token (state) {
      return state.user.userInfo.token
    }
  }
})
export default store
